<?php

namespace App\Models\Scenic;

use App\Facades\SnowFlakeFacade;
use Illuminate\Database\Eloquent\Model;

class ScenicSpotGoodsProvider extends Model
{


    /**
     * 注册供应商门票
     * @param $provider
     * @param string $providerTicketId
     * @return ScenicSpotGoodsProvider
     */
    public function registerProviderTicket($provider,$scenic_id,string $providerTicketId) :ScenicSpotGoodsProvider
    {
        $ticketModel = new ScenicSpotGoodsProvider();
        $ticketModel->scenic_id = $scenic_id;
        $ticketModel->ticket_id = SnowFlakeFacade::id();
        $ticketModel->provider = $provider;
        $ticketModel->provider_ticket_id = $providerTicketId;
        $ticketModel->sale_price = 0;
        $ticketModel->provider_sale_price = 0;
        $ticketModel->created_at = time();
        $ticketModel->updated_at = time();
        $ticketModel->save();
        return $ticketModel;
    }
}
